Greedy Contextualized Rewrites

ABSTRACT

Methods, systems, and apparatus, including computer programs encoded on a computer storage medium, for generating rewrites are disclosed. In one embodiment, an original rewrite operation is identified with a source term and a target term, and queries containing the source term are identified. For each query, an importance score is identified for the source term, and for an additional term prior to or after the source term. If the importance weight of the additional term is greater than the source term, the additional term may be added to a new rewrite source. If the number of times the new rewrite source appears in the queries meets a threshold, a new rewrite operation may be generated which specifies the source term should be replaced with the target term, and including the additional term.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application claims the benefit of U.S. Provisional Appl. No.61/481,528, filed May 2, 2011, which is hereby incorporated by referencein its entirety.

BACKGROUND

The Internet provides access to a wide range of resources. For example,web pages for particular subjects are accessible over the Internet.Access to these resources presents opportunities for advertisements tobe provided with the resources. A web page can, for example, includeadvertisement slots in which advertisements can be presented. Theseadvertisements slots can be defined for presentation with a web page,for example, in a pop-up window. The advertisements slots can also bedefined in the web page.

When a user performs a search using query terms, the query terms areused to identify relevant advertisements for the slots. Theadvertisements can be identified a number of ways. One way is if theyare associated with keywords that match the query. Other times theadvertisements can be identified based on an expanded match, where thequery has been associated with keywords by an advertisement system, andthese keywords are used to identify relevant advertisements. Thesekeywords can be generated by applying rewrite operators to rewrite thequeries. However, the context of the query may not be included.

BRIEF SUMMARY

Embodiments include systems and methods for preserving the context of aquery to be rewritten. According to an embodiment, a method may includeidentifying an original rewrite operation including a source term and atarget term, and one or more queries, wherein each of the queriesincludes the source term. For each query, a first occurrence of thesource term is identified, and an importance weight is identified forthe source term. A determination is made as to whether the queryincludes additional terms prior to the source term. If the queryincludes additional terms, an importance weight for an additional termprior to the source term is identified. If the importance weight of theadditional term prior to the source term is greater than the importanceweight of the first term in the source term, a new rewrite source isgenerated that includes the source term and the additional term prior tothe source term. A determination is made to identify how many times thenew rewrite source appears in the one or more queries. If the numbermeets a threshold, a final rewrite operation is generated, where thefinal rewrite operation specifies replacing the source term in the newrewrite source with the target term.

According to another embodiment, a system may include an advertisementengine configured to identify an original rewrite operation including asource term and a target term, and one or more queries, wherein each ofthe queries includes the source term. For each query, the advertisementengine may identify a first occurrence of the source term, and identifyan importance weight for the source term. A determination is made as towhether the query includes additional terms prior to the source term. Ifthe query includes additional terms, an importance weight for anadditional term prior to the source term is identified. If theimportance weight of the additional term prior to the source term isgreater than the importance weight of the first term in the source term,a new rewrite source is generated that includes the source term and theadditional term prior to the source term. A determination is made toidentify how many times the new rewrite source appears in the one ormore queries. If the number meets a threshold, a final rewrite operationis generated, where the final rewrite operation specifies replacing thesource term in the new rewrite source with the target term.

According to another embodiment, a computer readable storage mediumencoded with a computer program is provided. The program comprisinginstructions that when executed by one or more processors cause the oneor more processors to perform operations comprising identifying anoriginal rewrite operation including a source term and a target term,and identifying one or more queries, wherein each of the queriesincludes the source term; identifying queries, and identifying a rewriteoperator, wherein the rewrite operator includes a function to rewrite aquery. For each query, a first occurrence of the source term isidentified, and an importance weight is identified for the source term.A determination is made as to whether the query includes additionalterms prior to the source term. If the query includes additional terms,an importance weight for an additional term prior to the source term isidentified. If the importance weight of the additional term prior to thesource term is greater than the importance weight of the first term inthe source term, a new rewrite source is generated that includes thesource term and the additional term prior to the source term. Adetermination is made to identify how many times the new rewrite sourceappears in the one or more queries. If the number meets a threshold, afinal rewrite operation is generated, where the final rewrite operationspecifies replacing the source term in the new rewrite source with thetarget term.

Further embodiments, features, and advantages, as well as the structureand operation of the various embodiments are described in detail belowwith reference to accompanying drawings.

BRIEF DESCRIPTION OF THE DRAWINGS/FIGURES

Embodiments are described with reference to the accompanying drawings.In the drawings, like reference numbers may indicate identical orfunctionally similar elements. The drawing in which an element firstappears is generally indicated by the left-most digit in thecorresponding reference number.

FIG. 1 is rewrite operation example.

FIG. 2 is a block diagram of an example environment in which anadvertisement system manages advertising services.

FIG. 3 is a flowchart illustrating a method for generating rewriteoperations, according to an embodiment.

FIG. 4 is a flowchart illustrating a method for generating rewriteoperations, according to an embodiment.

FIG. 5 is a swim lane diagram.

FIG. 6 is a system diagram that can be used to implement embodimentsdescribed herein.

DETAILED DESCRIPTION OF THE INVENTION

Embodiments are described herein with reference to illustrations forparticular applications. It should be understood that the invention isnot limited to the embodiments. Those skilled in the art with access tothe teachings provided herein will recognize additional modifications,applications, and embodiments within the scope thereof and additionalfields in which the embodiments would be of significant utility.

Advertisers can bid on keywords for an advertisement. In some cases,when a user submits a search query, if the query terms match thekeywords, the advertisement is identified as a responsive advertisement.Other times, terms in the search query are rewritten according topreviously established rewrite rules or operators, to identifyadditional advertisements that may be responsive.

FIG. 1 is a diagram of system including a contextualized rewritegenerator 120, in accordance with embodiments.

Rewrite operators 102 may be identified that are used to rewrite queries110. A rewrite operator is a function that changes a query into anotherquery. The operators can include deleting words, replacing words,sorting words, or adding words.

The rewrite operators specify a source term 104 and a target term 106. Asource term and target term may be one or more words. In this example,rewrite operators 108 includes BROWN FOX→RED WOLF and rewrite operator109 includes PINK→RED. Rewrite operator 108 BROWN FOX→RED WOLF specifiesthat when an instance of the source term BROWN FOX is located in aquery, it should be replaced with the target term RED WOLF. Rewriteoperator 109 PINK→RED specifies that when an instance of the word PINKis located in a query, it should be replaced with the word RED.

For certain queries, the context of a query may be useful to identifyresponsive advertisements. The context of the query can includesurrounding words. For example, in the query “the clever brown fox jumpsover the lazy dog”, the context of the query, including words prior tothe source term, such as “clever”, or words subsequent to the sourceterm, such as “jumps”, may be a frequently found phrase or term. Thus,rewriting a query while preserving the context of that query may beuseful. For example, the query term with context “clever brown fox” maybe rewritten according to the rewrite rules to generate “clever redwolf.”

The context of a query may be determined in a greedy manner bycontextualized rewrite generator 120. For example, terms in a query maybe associated with an importance weight. The importance weight may bebased on the inverse document frequency (IDF) or inverse query frequency(IQF) of a particular term. The IDF of a particular term measures howrare or common a given term is in a collection of documents. The IQF ofa particular term measures how rare or common a given term is in acollection of queries. In both IDF and IQF, the IDF or IQF is higher ifthe term is rarer. If the importance weight of a given term is greaterthan the importance weight of a source term, the given term may beuseful in further search queries.

Thus, for example, each term in a given query may have a previouslydetermined importance weight. As shown in FIG. 1, each query term inquery 112 has an associated importance weight as shown in box 116. Forexample, query term “clever” has an importance weight of 10.0, queryterm “brown” has an importance weight of 4.0, query term “fox” has animportance weight of 6.0, query term “jumps” has an importance weight of8.0, query term “over” has an importance weight of 9.0, query term“lazy” has an importance weight of 12.0, and query term “dog” has animportance weight of 5.0.

The importance weight of terms may be determined using a pre-computedlookup table for query term importance weights. Query terms may also beknown as unigrams. For example, a lookup table may have beenpre-computed that can determine the IDF of each term in a set of queryterms. The lookup table may be stored, for example and withoutlimitation, in a database. Other data structures may be used as well, aswill be apparent to those of skill in the art.

Based on the importance weight of additional terms, new rewrite sources118 may be generated, in accordance with embodiments, by contextualizedrewrite generator 120. For example, new rewrite sources 118 “cleverbrown fox”, “brown fox jumps”, “clever brown fox jumps”, “brown foxjumps over”, and “clever brown fox jumps over”, may be generated asdescribed below. In some embodiments, the importance weight ofadditional terms, relative to the importance weight of other terms, isused to generate new rewrite sources 118.

Based on the new rewrite sources 118, contextualized rewrite generator120 may output final rewrite operations 130. In FIG. 1, for example,final rewrite operation 131 specifies that the phrase “clever brown fox”should be replaced with “clever red wolf”. Final rewrite operation 131may be generated based on the importance weights of the various terms inthe query. For example, starting with the word in the source term“brown” having an importance weight of 4.0, the previous term “clever”is identified to have an importance weight of 10.0. Since the importanceweight of the term “clever” is greater than that of “brown”, “cleverbrown fox” may be added to new rewrite sources 118, and final rewriteoperation 131 may be generated. In some cases, the contextualizedrewrite generator 120 stops here and does not look for additional terms.

In other cases, the contextualized rewrite generator 120 may start bylooking at terms after the source term. Final rewrite operation 132specifies that the phrase “brown fox jumps over” should be replaced with“red wolf jumps over”. Starting with the word in the source term “fox”having an importance weight of 6.0, the first term after the sourceterm, “jumps”, is identified to have an importance weight of 8.0. Sincethe importance weight of the term “jumps” is greater than that of “fox”,“brown fox jumps” may be added to new rewrite sources 118, and finalrewrite operation 132 may be generated. Final rewrite operations 130 maybe used to identify relevant advertisements to a user entering a searchquery.

Final rewrite operations 130 may also add terms both to prior to andafter the source term. For example, because the identified importanceweights of the terms “clever” and “jumps” are both greater than theimportance weight of the source term “brown fox”, a new rewrite source118 may be generated that contains “clever brown fox jumps”. Thus, afinal rewrite operation 133 may be generated that specifies the phrase“clever brown fox jumps” should be replaced with “clever red wolfjumps”.

In some cases, if the importance weight of the term before the sourceterm is higher than the source term, then a check can also be made ifthere is an additional term before that term. In the same manner, theterms after can be checked until a term is reached that includes animportance weight lower than the term prior to the term, or until nomore terms are left. In this example, the term “over” exists after“jumps” and includes an importance weight of 9.0, which is higher thanthe importance weight of “jumps” which is 8.0. Therefore, a finalrewrite operation 134 may be generated that specifies the phrase “brownfox jumps over” should be replaced with “red wolf jumps over.”Combinations of the above situations may lead to a final rewriteoperation 135 that specifies “clever brown fox jumps over” should bereplaced with “clever red wolf jumps over”.

In embodiments, final rewrite sources may specify that a new rewritesource should be replaced with the original target term. Therefore, afinal rewrite operation 136 may be generated that specifies the phrase“brown fox jumps over” should be replaced with “red wolf”. Any of theserewrites can be used to rewrite queries and to identify relevantadvertisements. Embodiments may capture the maximum contextualinformation available for a given query.

FIG. 2 is a block diagram of an example environment 200 in which anadvertisement system 202 manages advertising services. The exampleenvironment 200 includes one or more networks 204, such as a local areanetwork (LAN), a wide area network (WAN), the Internet, or a combinationthereof. The network 204 connects user devices 206, websites 208,advertisers 210, and the advertisement system 202. The environment 200may include many thousands of user devices 206, websites 208, andadvertisers 210.

A website 208 is one or more resources 212 associated with a domain nameand hosted by one or more servers. An example website is a collection ofweb pages formatted in hypertext markup language (HTML) that can containtext, images, multimedia content, and programming elements, such asscripts. Each website 208 is maintained by a publisher, which is anentity that controls, manages and/or owns the website 204.

A resource 212 is any data that can be provided over the network 204. Aresource 212 is identified by a resource address that is associated withthe resource 212. Resources include HTML pages, word processingdocuments, and portable document format (PDF) documents, images, video,and feed sources, to name only a few. The resources can include content,such as words, phrases, images and sounds, that may include embeddedinformation (such as meta-information in hyperlinks) and/or embeddedinstructions (such as JavaScript scripts).

A user device 206 is an electronic device that is under control of auser and is capable of requesting and receiving resources over thenetwork 204. Example user devices 206 include personal computers, mobilecommunication devices, and other devices that can send and receive dataover the network 204. A user device 206 typically includes a userapplication, such as a web browser, to facilitate the sending andreceiving of data over the network 204.

A user device 206 can request resources 212 from a website 208. In turn,data representing the resource 212 can be provided to the user device206 for presentation by the user device 206. The data representing theresource 212 can also include data specifying a portion of the resourceor a portion of a user display (e.g., a presentation location of apop-up window or in a slot of a web page) in which advertisements can bepresented. These specified portions of the resource or user display arereferred to as advertisement slots.

To facilitate searching of these resources, the environment can includea search system 214 that identifies the resources by crawling andindexing the resources provided by the publishers on the websites 208.Data about the resources can be indexed based on the resource to whichthe data corresponds. The indexed and, optionally, cached copies of theresources are stored in an indexed cache 216.

User devices 206 can submit search queries 220 to the search system 214over the network 204. In response, the search system 214 accesses theindexed cache 216 to identify resources that are relevant to the searchquery 220. The search system 214 identifies the resources in the form ofsearch results 218 and returns the search results 218 to the userdevices 206 in search results pages. A search result 218 is datagenerated by the search system 214 that identifies a resource that isresponsive to a particular search query, and includes a link to theresource. An example search result 218 can include a web page title, asnippet of text or a portion of an image extracted from the web page,and the URL of the web page. Search results pages can also include oneor more advertisement slots in which advertisements can be presented.

When a resource 212 or search results 218 are requested by a user device206, the advertisement system 202 receives a request for advertisementsto be provided with the resource 212 or search results 218. The requestfor advertisements can include characteristics of the advertisementslots that are defined for the requested resource or search resultspage, and can be provided to the advertisement system 202.

For example, a reference (e.g., URL) to the resource for which theadvertisement slot is defined, a size of the advertisement slot, and/ormedia types that are available for presentation in the advertisementslot can be provided to the advertisement system 202. Similarly,keywords associated with a requested resource (“resource keywords”) or asearch query 220 for which search results are requested can also beprovided to the advertisement system 202 to facilitate identification ofadvertisements that are relevant to the resource or search query 220.

Based on data included in the request for advertisements, theadvertisement system 202 can select advertisements that are eligible tobe provided in response to the request (“eligible advertisements”). Forexample, eligible advertisements can include advertisements havingcharacteristics matching the characteristics of advertisement slots andthat are identified as relevant to specified resource keywords or searchqueries 220. In some implementations, advertisements having targetingkeywords that match the resource keywords or the search query 220 areselected as eligible advertisements by the advertisement system 202.

A targeting keyword can match a resource keyword or a search query 220by having the same textual content (“text”) as the resource keyword orsearch query 220. For example, an advertisement associated with thetargeting keyword “daisy” can be an eligible advertisement for anadvertisement request including the resource keyword “daisy.” Similarly,the advertisement can be selected as an eligible advertisement for anadvertisement request including the search query “daisy.”

A targeting keyword can also match a resource keyword or a search query220 by having text that is identified as being relevant to a targetingkeyword or search query 220 despite having different text than thetargeting keyword. For example, an advertisement having the targetingkeyword “daisy” may also be selected as an eligible advertisement for anadvertisement request including a resource keyword or search query for“flowers” because daisy is a type of flower, and therefore, is likely tobe relevant to the word “flowers.”

The advertisement system 202 can select the eligible advertisements thatare provided for presentation in advertisement slots of a resource orsearch results page based on results of an auction. For example, theadvertisement system 202 can receive bids from advertisers and allocatethe advertisement slots to the highest bidders at the conclusion of theauction. The bids are amounts that the advertisers are willing to payfor presentation (or selection) of their advertisement with a resourceor search results page. For example, a bid can specify an amount that anadvertiser is willing to pay for each 1000 impressions (i.e.,presentations) of the advertisement, referred to as a CPM bid.Alternatively, the bid can specify an amount that the advertiser iswilling to pay for a selection (i.e., a click-through) of theadvertisement or a “conversion” following selection of theadvertisement. The highest bidders can be determined based on the bidsalone, or based on the bids of each bidder being multiplied by one ormore factors, such as quality scores derived from advertisementperformance, landing page scores, and the like.

Advertisers can also specify budgets for their advertisement campaigns.A budget is a specified amount that an advertiser is willing to pay fordistribution of content over a specified budget period. The specifiedperiod can be, for example, a specified time (e.g., one day, one week,or one year), a specified number of events (e.g., a number ofimpressions or clicks), or some other delineation of time or events.Once the amount the advertiser is charged for distribution of contentduring the budget period matches or exceeds the budget amount, thecampaign can be prevented from providing content for the remainder ofthe budget period unless the advertiser increases or overrides itsspecified budget.

A conversion occurs when a user performs a particular action related toan advertisement provided with a resource or search results page. Whatconstitutes a conversion may vary from case to case and can bedetermined in a variety of ways. For example, a conversion may occurwhen a user clicks on an advertisement, is referred to a web page, andconsummates a purchase there before leaving that web page. A conversioncan also be defined by an advertiser to be any measurable/observableuser action such as, for example, downloading a white paper, navigatingto at least a given depth of a website, viewing at least a certainnumber of web pages, spending at least a predetermined amount of time ona website or web page, or registering on a website. Other actions thatconstitute a conversion can also be used.

Each advertisement provided by an advertiser 210 can be associated witha one or more keywords selected by the advertiser. The advertisementsystem 202 can facilitate the generation of keywords to associate withsearch queries offline. The keywords are generated by substitutingsynonyms or by deleting words from the query as well as using otherfunctions such as replacing words with other words. In addition,keywords may be generated by identifying the importance of the contextof a query to generate contextualized rewrites. Generating new rewriteoperations may be performed offline with the assistance ofcontextualized rewrite generator 120. New rewrite operations may begenerated in accordance with methods 300 and 400 of FIG. 3 and FIG. 4,respectively. A system that can be used to implement these examples isthen described with reference to FIG. 6.

FIG. 3 illustrates an exemplary method 300 for generating new rewriteoperators, according to an embodiment.

In step 310, an original rewrite operation, including a source term anda query term, is identified. The original rewrite operation may be froma database of rewrite operations, such as rewrite operators 230. Therewrite operation can be a function to replace a word with another word,to delete a word, or to add a word to a query.

In step 320, one or more queries, each query including the source term,are identified. Queries may be obtained from a log of user-enteredqueries or queries generated by other methods. The identified querieseach contain the source term.

Steps 331 through 336 of method 300 are performed for each query. Atstep 331, a first occurrence of the source term is identified. Forexample, the first occurrence of the source term may be the third termin the query.

In step 332, an importance weight of the first term in the source termis identified. If the source term is only one word, the importanceweight is determined for that word. As specified above, the importanceweight may be based on the IDF or IQF of the source term, or anotherimportance weight measure.

In step 333, a determination is made as to whether any terms exist priorto the source term. For languages written from left to right, such asEnglish, a determination is made as to whether any terms exist to theleft of the source term.

In step 334, if an additional term prior to the source term exists, animportance weight of the additional term is identified.

In step 335, a determination is made as to whether the importance weightof the additional term prior to the source term is greater than theimportance weight of the first term in the source term. Therefore, theimportance weight of the first term in the source term is compared tothe importance weight of the additional term.

In step 336, if the determination of step 335 is that the importanceweight of the additional term is greater than the importance weight ofthe first term in the source term, a new rewrite source is generatedthat includes both the source term and the additional term prior to thesource term. As stated above, steps 331 through 336 may be repeated foreach query identified at step 320.

In step 340, the one or more queries identified at 320 may be searchedto determine how many times a new rewrite source appears in the one ormore queries. For example, in a set of 1,000,000 queries, a new rewritesource may appear in 100,000 queries.

If the number of times the new rewrite source appears in the set of oneor more queries meets a threshold, in step 350 then, a final rewriteoperation is generated. The final rewrite operation may specifyreplacing the source term in the new rewrite source with the targetterm.

Once the final rewrite operation is generated, the final rewriteoperation can be applied to queries online. For example, in anembodiment, an original search query may be received. The originalsearch query may include the new rewrite source. New keywords may begenerated by applying the final rewrite operation to the new rewritesource in the original search query. Once the final rewrite operation isapplied, advertisements responsive to the generated keywords may beidentified, and suggested to a user.

In an embodiment, for each query, a determination is made as to whetheradditional terms exist after the source term in the query. Based on thedetermination, an importance weight of an additional term after thesource term is identified. If the importance weight of the additionalterm after the source term in the query is greater than the importanceweight of the last term in the source term, the additional term may beadded to generate a new rewrite source including the source term and theadditional term after the source term.

In an embodiment, for each query, a determination may be made as towhether additional terms exist prior to the additional term prior to thesource term in the query. That is to say, a determination may be made ifthe query includes three terms or more, and the source term has twoadditional terms prior to it. If such a term exists, an importanceweight of the additional term prior to the first additional term may beidentified. If the importance weight of the additional term prior to thefirst additional term is greater than the importance weight of the firstadditional term, the term may be added to the new rewrite source. Forexample, as in FIG. 3, the new rewrite source may be set as the sourceterm at step 360, and steps 333 through 336 may be repeated to determineif any additional terms prior to the additional term prior to the sourceterm in the query should be added to the rewrite source.

According to embodiments, as an example, consider query 112 “the cleverbrown fox jumps over the lazy dog.” An original rewrite operation 108may be identified, in accordance with block 310 that specifies BROWN FOXis to be replaced by RED WOLF. Thus, in accordance with block 320, oneor more queries, each query including the source term, may beidentified. Query 112 includes the source term “brown”.

In accordance with block 331, for query 112, the first occurrence of thesource term of the rewrite rule may be identified after the second wordin the query. In accordance with block 332, the importance weight of thefirst term in the source term “brown” is identified as 4.0. Thedetermination as to whether the query includes additional terms prior tothe source term, in accordance with block 333, may lead to anidentification of the additional term “clever”. Thus, in accordance withblock 333, the importance weight of the additional term “clever” may beidentified to be 10.0. In accordance with block 334, because theimportance weight of the term “clever” is greater than the importanceweight of the term “brown” (10.0 is greater than 4.0), the term “clever”may be added to a new rewrite source to generate a new rewrite source of“clever brown fox”, in accordance with block 336.

In accordance with block 340, queries 110 may be searched to determinehow many times the new rewrite source appears in the list of queries. Ifthe number of times the new rewrite “clever brown fox” appears in thelist of queries meets a threshold, in accordance with block 350, then afinal rewrite operation 131 may be generated that specifies “cleverbrown fox” should be rewritten to “clever red wolf”.

Thus, a user may enter an original search query containing the phrase“clever brown fox”. According to the final rewrite operation 131,“clever brown fox” may be rewritten to be “clever red wolf”.Advertisements responsive to new keywords “clever red wolf” may beidentified and displayed for the user to view.

According to an embodiment, steps 310, 320, 331, 332, 333, 334, 335,336, 340 and 350 may be performed by an advertisement module 202 and acontextualized rewrite generator 120.

FIG. 4 illustrates an exemplary method 400 for generating new rewriteoperators, according to an embodiment.

In step 410, an original rewrite operation, including a source term anda query term, is identified. The original rewrite operation may be froma database of rewrite operations, such as rewrite operators 230. Therewrite operation can be a function to replace a word with another word,to delete a word, or to add a word to a query.

In step 420, one or more queries, each query including the source term,are identified. Queries may be obtained from a log of user-enteredqueries or queries generated by other methods.

Steps 431 through 436 of method 400 are performed for each query. Atstep 431, a first occurrence of the source term is identified. Forexample, the first occurrence of the source term may be the third termin the query.

In step 432, an importance weight of the last term in the source term isidentified. If the source term is only one word, the importance weightis determined for that word. As specified above, the importance weightmay be based on the IDF or IQF of the source term, or another importanceweight measure.

In step 433, a determination is made as to whether any terms exist afterthe source term. For languages written from left to right, such asEnglish, a determination is made as to whether any terms exist to theright of the source term.

In step 434, if an additional term after the source term exists, animportance weight of the additional term is identified.

In step 435, a determination is made as to whether the importance weightof the additional term after the source term is greater than theimportance weight of the last term in the source term.

In step 436, if the determination of step 435 is that the importanceweight of the additional term is greater than the importance weight ofthe last term in the source term, a new rewrite source is generated thatincludes both the source term and the additional term after the sourceterm. As stated above, steps 431 through 436 may be repeated for eachquery identified at step 420.

In step 440, the one or more queries identified at 420 may be searchedto determine how many times the new rewrite source appears in the one ormore queries. For example, in a set of 1,000,000 queries, the newrewrite source may appear in 100,000 queries.

If the number of times the new rewrite source appears in the set of oneor more queries meets a threshold, in step 450 then, a final rewriteoperation is generated. The final rewrite operation may specifyreplacing the source term in the new rewrite source with the targetterm.

Once the final rewrite operation is generated, the final rewriteoperation can be applied to queries online. For example, in anembodiment, an original search query may be received. The originalsearch query may include the new rewrite source. New keywords may begenerated by applying the final rewrite operation to the new rewritesource in the original search query. Once the final rewrite operation isapplied, advertisements responsive to the generated keywords may beidentified, and suggested to a user. In some embodiments, as additionalrewrite operations are generated, the additional rewrite operations canbe used to generate further new keywords. Thus, for subsequent queries,these additional rewrite operations can be used to identifyadvertisements responsive to further new keywords.

In an embodiment, for each query, a determination is made as to whetheradditional terms exist prior to the source term in the query. Based onthe determination, an importance weight of an additional term prior tothe source term is identified. If the importance weight of theadditional term prior to the source term in the query is greater thanthe importance weight of the first term in the source term, theadditional term may be added to generate a new rewrite source includingthe source term and the additional term after the source term.

In an embodiment, for each query, a determination may be made as towhether additional terms exist after the additional term after thesource term in the query. That is to say, a determination may be made ifthe query includes three terms or more, and the source term has twoadditional terms after it. If such a term exists, an importance weightof the additional term after the first additional term may beidentified. If the importance weight of the additional term after thefirst additional term is greater than the importance weight of the firstadditional term, the term may be added to the new rewrite source. Forexample, as in FIG. 4, the new rewrite source may be set as the sourceterm at step 460, and steps 433 through 436 may be repeated to determineif any additional terms after the additional term after the source termin the query should be added to the rewrite source.

According to embodiments, as an example, consider query 112 “the cleverbrown fox jumps over the lazy dog.” An original rewrite operation orrule 108 may be identified, in accordance with block 410 that specifiesBROWN FOX is to be replaced by RED WOLF. Thus, in accordance with block420, one or more queries, each query including the source term, may beidentified. Query 112 includes the source term “brown fox”.

In accordance with block 431, for query 112, the first occurrence of thesource term of the rewrite rule may be identified after the second wordin the query. In accordance with block 432, the importance weight of thelast term in the source term “fox” is identified as 6.0. Thedetermination as to whether the query includes additional terms prior tothe source term, in accordance with block 433, may lead to anidentification of the additional term “jumps”. Thus, in accordance withblock 433, the importance weight of the additional term “jumps” may beidentified to be 8.0. In accordance with block 434, because theimportance weight of the term “jumps” is greater than the importanceweight of the term “fox”, the term “jumps” may be added to a new rewritesource to generate a new rewrite source of “brown fox jumps”, inaccordance with block 436.

In accordance with block 440, queries 110 may be searched to determinehow many times the new rewrite source appears in the list of queries. Ifthe number of times the new rewrite “brown fox jumps” appears in thelist of queries meets a threshold, in accordance with block 450, then afinal rewrite operation 132 may be generated that specifies “brown foxjumps” should be rewritten to “red wolf jumps”.

As mentioned, the above methods of generating contextualized rewritesmay be expanded to include additional query terms. For example, query112 includes an additional term after the term “jumps”. Since theimportance weight of additional term “over” is greater than theimportance weight of term “jumps”, the additional teen may be added togenerate a new rewrite source “brown fox jumps over”. If the number oftimes new rewrite source “brown fox jumps over” appears in queries 110meets a threshold, a final rewrite operation may be generated thatspecifies “brown fox jumps over” should be replaced with “red wolf jumpsover”.

According to embodiments disclosed herein, if the importance weight ofan additional term is not greater than the importance weight of a sourceterm or another term either prior to or after the additional term(depending on embodiments), the additional term may not be included in anew rewrite source. Embodiments may use a greedy or hill-climbingalgorithm to determine the length of a new rewrite source. Thus,provided the importance weight of a term to be added is greater than theimportance weight of the term immediately prior to or after the term tobe added, the term to be added may be included in the new rewritesource.

In accordance with embodiments, terms prior to and after the source termmay be added to generate new rewrite sources and final rewriteoperations. In the example of FIG. 1, term “clever” is prior to sourceterm “brown fox”, and has a greater importance weight than the firstterm in the source term. Additionally, term “jumps” is after source term“brown fox”, and has a greater importance weight than the source term.Thus, a new rewrite source may be generated that includes term “clever”and term “jumps” to read “clever brown fox jumps”. In accordance withembodiments, if the number of times new rewrite source “clever brown foxjumps” appears in the set of queries meets a threshold, a final rewriteoperation 133 may be generated that specifies “clever brown fox jumps”should be rewritten to “clever red wolf jumps”.

As detailed above, if the query contains further additional terms, theseterms may be added to generate new rewrite sources and final rewriteoperations. For example, query term “over” has a higher importanceweight than query term “jumps”. Thus, in accordance with embodiments,query term “over” may be added to generate a new rewrite source 118“clever brown fox jumps over”. Accordingly, if the number of times“clever brown fox jumps over” appears in the set of queries meets athreshold, a final rewrite operation may be generated that specifies“clever brown fox jumps over” should be rewritten to “clever red wolfjumps over”.

FIG. 5 is a swim lane diagram illustrating a process for calculatingquality scores for rewrite operators. In this illustration, a remoteserver system (e.g., au advertisement system 202) generatescontextualized rewrites in step 502, as detailed in steps 350 and 450 ofmethods 300 and 400. Contextualized rewrite operations can be used torewrite queries. A user device 206 may submit an original search queryin step 504. The server system, at step 506, may receive the originalsearch query. A rewritten query may be generated by the server system atstep 508 by applying the contextualized rewrites. Based on the rewrittenquery generated at step 508, advertisements responsive to the rewrittenquery may be identified at step 510 by advertisement system 202. Userdevice 206 may then display the identified advertisements at step 512.

FIG. 6 illustrates an example computer system 600 in which embodimentsof the present invention, or portions thereof, may be implemented ascomputer-readable code. For example, advertisement system 202 may beimplemented in computer system 600 using hardware, software, firmware,tangible computer readable media having instructions stored thereon, ora combination thereof and may be implemented in one or more computersystems or other processing systems. Hardware, software, or anycombination of such may embody any of the modules and components inFIGS. 1-5.

If programmable logic is used, such logic may execute on a commerciallyavailable processing platform or a special purpose device. One ofordinary skill in the art may appreciate that embodiments of thedisclosed subject matter can be practiced with various computer systemconfigurations, including multi-core multiprocessor systems,minicomputers, mainframe computers, computers linked or clustered withdistributed functions, as well as pervasive or miniature computers thatmay be embedded into virtually any device.

For instance, a computing device having at least one processor deviceand a memory may be used to implement the above-described embodiments. Aprocessor device may be a single processor, a plurality of processors,or combinations thereof. Processor devices may have one or moreprocessor “cores.”

Various embodiments of the invention are described in terms of thisexample computer system 600. After reading this description, it willbecome apparent to a person skilled in the relevant art how to implementthe invention using other computer systems and/or computerarchitectures. Although operations may be described as a sequentialprocess, some of the operations may in fact be performed in parallel,concurrently, and/or in a distributed environment, and with program codestored locally or remotely for access by single or multi-processormachines. In addition, in some embodiments the order of operations maybe rearranged without departing from the spirit of the disclosed subjectmatter.

Processor device 604 may be a special purpose or a general-purposeprocessor device. As will be appreciated by persons skilled in therelevant art, processor device 604 may also be a single processor in amulti-core/multiprocessor system, such system operating alone, or in acluster of computing devices operating in a cluster or server farm.Processor device 604 is connected to a communication infrastructure 606,for example, a bus, message queue, network, or multi-coremessage-passing scheme.

Computer system 600 also includes a main memory 608, for example, randomaccess memory (RAM), and may also include a secondary memory 610.Secondary memory 610 may include, for example, a hard disk drive 612,removable storage drive 614. Removable storage drive 614 may comprise afloppy disk drive, a magnetic tape drive, an optical disk drive, a flashmemory, or the like. The removable storage drive 614 reads from and/orwrites to a removable storage unit 618 in a well-known manner. Removablestorage unit 618 may comprise a floppy disk, magnetic tape, opticaldisk, etc., which is read by and written to by removable storage drive614. As will be appreciated by persons skilled in the relevant art,removable storage unit 618 includes a computer usable storage mediumhaving stored therein computer software and/or data.

In alternative implementations, secondary memory 610 may include othersimilar means for allowing computer programs or other instructions to beloaded into computer system 600. Such means may include, for example, aremovable storage unit 622 and an interface 620. Examples of such meansmay include a program cartridge and cartridge interface (such as thatfound in video game devices), a removable memory chip (such as an EPROM,or PROM) and associated socket, and other removable storage units 622and interfaces 620 which allow software and data to be transferred fromthe removable storage unit 622 to computer system 600.

Computer system 600 may also include a communications interface 624.Communications interface 624 allows software and data to be transferredbetween computer system 600 and external devices. Communicationsinterface 624 may include a modem, a network interface (such as anEthernet card), a communications port, a PCMCIA slot and card, or thelike. Software and data transferred via communications interface 624 maybe in the form of signals, which may be electronic, electromagnetic,optical, or other signals capable of being received by communicationsinterface 624. These signals may be provided to communications interface624 via a communications path 626. Communications path 626 carriessignals and may be implemented using wire or cable, fiber optics, aphone line, a cellular phone link, an RF link or other communicationschannels.

In this document, the terms “computer program storage medium,” “computerusable storage medium,” and “computer readable storage medium” are usedto generally refer to media such as removable storage unit 618,removable storage unit 622, and a hard disk installed in hard disk drive612. Computer program medium, computer usable medium, and computerreadable storage medium may also refer to memories, such as main memory608 and secondary memory 610, which may be memory semiconductors (e.g.DRAMs, etc.). These do not refer to transitory signals of software anddata.

Computer programs (also called computer control logic) are stored inmain memory 608 and/or secondary memory 610. Computer programs may alsobe received via communications interface 624. Such computer programs,when executed, enable computer system 600 to implement the presentinvention as discussed herein. In particular, the computer programs,when executed, enable processor device 604 to implement the processes ofthe present invention, such as the stages in the method illustrated byflowchart 300 of FIG. 3 discussed above. Accordingly, such computerprograms represent controllers of the computer system 600. Where theinvention is implemented using software, the software may be stored in acomputer program product and loaded into computer system 600 usingremovable storage drive 614, interface 620, and hard disk drive 612, orcommunications interface 624.

Embodiments of the invention also may be directed to computer programproducts comprising software stored on any computer readable storagemedium. Such software, when executed in one or more data processingdevice, causes a data processing device(s) to operate as describedherein. Embodiments of the invention employ any computer useable orreadable medium. Examples of computer useable mediums include, but arenot limited to, primary storage devices (e.g., any type of random accessmemory), secondary storage devices (e.g., hard drives, floppy disks, CDROMS, ZIP disks, tapes, magnetic storage devices, and optical storagedevices, MEMS, nanotechnological storage device, etc.).

The embodiments have been described above with the aid of functionalbuilding blocks illustrating the implementation of specified functionsand relationships thereof. The boundaries of these functional buildingblocks have been arbitrarily defined herein for the convenience of thedescription. Alternate boundaries can be defined so long as thespecified functions and relationships thereof are appropriatelyperformed.

The foregoing description of the specific embodiments will so fullyreveal the general nature of the invention that others can, by applyingknowledge within the skill of the art, readily modify and/or adapt forvarious applications such specific embodiments, without undueexperimentation, without departing from the general concept of thepresent invention. Therefore, such adaptations and modifications areintended to be within the meaning and range of equivalents of thedisclosed embodiments, based on the teaching and guidance presentedherein. It is to be understood that the phraseology or terminologyherein is for the purpose of description and not of limitation, suchthat the terminology or phraseology of the present specification is tobe interpreted by the skilled artisan in light of the teachings andguidance.

The breadth and scope of the present invention should not be limited byany of the above-described exemplary embodiments, but should be definedonly in accordance with the following claims and their equivalents.

1. A computer-implemented method, comprising: identifying, by acontextualized rewrite generator specifically configured to generatequery rewrite operations that are used in rewriting queries submitted byuser devices, an original rewrite operation including a source term anda target term; identifying one or more queries, each query including thesource term; for each query: identifying a first occurrence of thesource term; identifying an importance weight of a first term in thesource term; determining whether the query includes additional termsprior to the source term in the query; identifying an importance weightof an additional term prior to the source term in the query based on thedetermination; determining whether the importance weight of theadditional term prior to the source term in the query is greater thanthe importance weight of the first term in the source term; generating,by the contextualized rewrite generator, a new rewrite source includingthe source term and the additional term prior to the source term in thequery, based on the determination; determining a number of times the newrewrite source appears in the one or more queries; and generating, bythe contextualized rewrite generator, a final rewrite operationincluding the new rewrite source if the number meets a threshold,wherein the final rewrite operation specifies replacing the source termin the new rewrite source with the target term; receiving a search querysubmitted by a user device; generating, after receiving the search queryand prior to providing content responsive to the search query, arewritten query based on rewriting the received query using the finalrewrite operation, wherein the rewritten query differs from the searchquery submitted by the user device; receiving, from a search system andin response to submitting the rewritten query to the search system,content selected by the search system using the rewritten query; andproviding, to the user device, and in response to the received searchquery, the received content.
 2. The method of claim 1, furthercomprising: for each query: determining whether the query includesadditional terms after the source term in the query; identifying animportance weight of an additional term after the source term in thequery based on the determination; identifying an importance weight of alast term in the source term; determining whether the importance weightof the additional term after the source term in the query is greaterthan the importance weight of the last term in the source term; andgenerating the new rewrite source including the source term and theadditional term after the source term in the query, based on thedetermination.
 3. The method of claim 1, further comprising: for eachquery: determining whether the query includes further additional termsprior to the additional term prior to the source term in the query;identifying an importance weight of an additional term prior to theadditional term prior to the source term in the query based on thedetermination; determining whether the importance weight of theadditional term prior to the additional term prior to the source term inthe query is greater than the importance weight of the additional termprior to the source term in the query; and generating the new rewritesource including the additional term prior to the source term in thequery and the additional term prior to the additional term prior to thesource term in the query.
 4. The method of claim 1, wherein the searchquery submitted by the user device includes the new rewrite source, themethod further comprising: generating keywords by applying the finalrewrite operation to the new rewrite source in the search querysubmitted by the user device; submitting the generated keywords to anadvertising system that is configured to identify advertisements thatare responsive to keywords; and providing, to the user device, one ormore advertisements received from the advertising system that theadvertising system identifies as responsive to the generated keywords.5. A computer-implemented method, comprising: identifying, by acontextualized rewrite generator specifically configured to generatequery rewrite operations that are used in rewriting queries submitted byuser devices, an original rewrite operation including a source term anda target term; identifying one or more queries, each query including thesource term; for each query: identifying a first occurrence of thesource term; identifying an importance weight of a last term in thesource term; determining whether the query includes additional termsafter the source term in the query; identifying an importance weight ofan additional term after the source term in the query based on thedetermination; determining whether the importance weight of theadditional term after the source term in the query is greater than theimportance weight of the last term in the source term; generating, bythe contextualized rewrite generator, a new rewrite source including thesource term and the additional term after the source term in the query,based on the determination; determining a number of times the newrewrite source appears in the one or more queries; and generating, bythe contextualized rewrite generator, a final rewrite operationincluding the new rewrite source if the number meets a threshold,wherein the final rewrite operation specifies replacing the source termin the new rewrite source with the target term receiving a search querysubmitted by a user device; generating, after receiving the search queryand prior to providing content responsive to the search query, arewritten query based on rewriting the received query using the finalrewrite operation, wherein the rewritten query differs from the searchquery submitted by the user device; receiving, from a search system andin response to submitting the rewritten query to the search system,content selected by the search system using the rewritten query; andproviding, to the user device, and in response to the received searchquery, the received content.
 6. The method of claim 5, furthercomprising: for each query: determining whether the query includesadditional terms prior to the source term in the query; identifying animportance weight of an additional term prior to the source term in thequery based on the determination; identifying an importance weight of afirst term in the source term; determining whether the importance weightof the additional term prior to the source term in the query is greaterthan the importance weight of the first term in the source term; andgenerating the new rewrite source including the source term and theadditional term prior to the source term in the query, based on thedetermination.
 7. The method of claim 5, further comprising: for eachquery: determining whether the query includes further additional termsafter the additional term after the source term in the query;identifying an importance weight of an additional term after theadditional term after the source term in the query based on thedetermination; determining whether the importance weight of theadditional term after the additional term after the source term in thequery is greater than the importance weight of the additional term afterthe source term in the query; and generating the new rewrite sourceincluding the additional term after the source term in the query and theadditional term after the additional term prior to the source term inthe query.
 8. The method of claim 5, wherein the search query submittedby the user device includes the new rewrite source, the method furthercomprising: generating keywords by applying the final rewrite operationto the new rewrite source in the search query submitted by the userdevice; submitting the generated keywords to an advertising system thatis configured to identify advertisements that are responsive tokeywords; and providing, to the user device, one or more advertisementsreceived from the advertising system that the advertising systemidentifies as responsive to the generated keywords.
 9. An advertisingsystem, comprising: one or more processors configured to executecomputer program instructions; and a non-transitory computer storagemedium encoded with computer program instructions that, when executed bythe one or more processors, cause the system to perform operationscomprising: identify, by a contextualized rewrite generator specificallyconfigured to generate query rewrite operations that are used inrewriting queries submitted by user devices, an original rewriteoperation including a source term and a target term; identify one ormore queries, each query including the source term; for each query:identify a first occurrence of the source term; identify an importanceweight of a first term in the source term; identify an importance weightof a last term in the source term; determine whether the query includesadditional terms prior to the source term in the query; identify animportance weight of an additional term prior to the source term in thequery based on the determination; determine whether the importanceweight of the additional term prior to the source term in the query isgreater than the importance weight of the first term in the source term;generate, by the contextualized rewrite generator, a new rewrite sourceincluding the source term and the additional term prior to the sourceterm in the query, based on the determination; determine whether thequery includes additional terms after the source term in the query;identify an importance weight of an additional term after the sourceterm in the query based on the determination; determine whether theimportance weight of the additional term after the source term in thequery is greater than the importance weight of the last term in thesource term; generate, by the contextualized rewrite generator, the newrewrite source including the source term and the additional term in thequery, based on the determination; determine a number of times the newrewrite source appears in the one or more queries; and generate, by thecontextualized rewrite generator, a final rewrite operation includingthe new rewrite source if the number meets a threshold, wherein thefinal rewrite operation specifies replacing the source term in the newrewrite source with the target term; receive a search query submitted bya user device; generate, after receiving the search query and prior toproviding content responsive to the search query, a rewritten querybased on rewriting the received query using the final rewrite operation,wherein the rewritten query differs from the search query submitted bythe user device; receive, from a search system and in response tosubmitting the rewritten query to the search system, content selected bythe search system using the rewritten query; and provide to the userdevice, and in response to the received search query, the receivedcontent.
 10. The system of claim 9, wherein the advertisement system isfurther configured to: for each query: determine whether the queryincludes further additional terms prior to the additional term prior tothe source term in the query; identify an importance weight of anadditional term prior to the additional term prior to the source term inthe query based on the determination; determine whether the importanceweight of the additional term prior to the additional term prior to thesource term in the query is greater than the importance weight of theadditional term prior to the source term in the query; and generate thenew rewrite source including the additional term prior to the sourceterm in the query and the additional term prior to the additional termprior to the source term in the query, based on the determination. 11.The system of claim 9, wherein the advertisement system is furtherconfigured to: for each query: determine whether the query includesfurther additional terms after the additional term after the source termin the query; identify an importance weight of an additional term afterthe additional term after the source term in the query based on thedetermination; determine whether the importance weight of the additionalterm after the additional term after the source term in the query isgreater than the importance weight of the additional term after thesource term in the query; and generate the new rewrite source includingthe additional term after the source term in the query and theadditional term after the additional term after the source term in thequery.
 12. The system of claim 9, wherein the search query submitted bythe user device includes the new rewrite source, and wherein theadvertisement system is further configured to: generate keywords byapplying the final rewrite operation to the new rewrite source in thesearch query submitted by the user device; submit the generated keywordsto an advertising system that is configured to identify advertisementsthat are responsive to keywords; and provide, to the user device, one ormore advertisements received from the advertising system that theadvertising system identifies as responsive to the generated keywords.13. A non-transitory computer readable storage medium encoded with acomputer program, the program comprising instructions that when executedby one or more processors cause the one or more processors to performoperations comprising: identifying, by a contextualized rewritegenerator specifically configured to generate query rewrite operationsthat are used in rewriting queries submitted by user devices, anoriginal rewrite operation including a source term and a target term;identifying one or more queries, each query including the source term;for each query: identifying a first occurrence of the source term;identifying an importance weight of a first term in the source term;determining whether the query includes additional terms prior to thesource term in the query; identifying an importance weight of anadditional term prior to the source term in the query based on thedetermination; determining whether the importance weight of theadditional term prior to the source term in the query is greater thanthe importance weight of the first term in the source term; generating,by the contextualized rewrite generator, a new rewrite source includingthe source term and the additional term prior to the source term in thequery, based on the determination; determining a number of times the newrewrite source appears in the one or more queries; and generating, bythe contextualized rewrite generator, a final rewrite operationincluding the new rewrite source if the number meets a threshold,wherein the final rewrite operation specifies replacing the source termin the new rewrite source with the target term; receiving a search querysubmitted by a user device; generating, after receiving the search queryand prior to providing content responsive to the search query, arewritten query based on rewriting the received query using the finalrewrite operation, wherein the rewritten query differs from the searchquery submitted by the user device; receiving, from a search system andin response to submitting the rewritten query to the search system,content selected by the search system using the rewritten query; andproviding, to the user device, and in response to the received searchquery, the received content.
 14. The computer readable storage medium ofclaim 13, the operations further comprising: for each query: determiningwhether the query includes additional terms after the source term in thequery; identifying an importance weight of an additional term after thesource term in the query based on the determination; identifying animportance weight of a last term in the source term; determining whetherthe importance weight of the additional term after the source term inthe query is greater than the importance weight of the last term in thesource term; and generating the new rewrite source including the sourceterm and the additional term after the source term in the query, basedon the determination.
 15. The computer readable storage medium of claim13, the operations further comprising: for each query: determiningwhether the query includes further additional terms prior to theadditional term prior to the source term in the query; identifying animportance weight of an additional term prior to the additional termprior to the source term in the query based on the determination;determining whether the importance weight of the additional term priorto the additional term prior to the source term in the query is greaterthan the importance weight of the additional term prior to the sourceterm in the query; and generating the new rewrite source including theadditional term prior to the source term in the query and the additionalterm prior to the additional term prior to the source term in the query.16. The computer readable storage medium of claim 13, wherein the searchquery submitted by the user device includes the new rewrite source, theoperations further comprising: generating keywords by applying the finalrewrite operation to the new rewrite source in the search querysubmitted by the user device; submitting the generated keywords to anadvertising system that is configured to identify advertisements thatare responsive to keywords; and providing, to the user device, one ormore advertisements received from the advertising system that theadvertising system identifies as responsive to the generated keywords.17. A non-transitory computer readable storage medium encoded with acomputer program, the program comprising instructions that when executedby one or more processors cause the one or more processors to performoperations comprising: identifying, by a contextualized rewritegenerator specifically configured to generate query rewrite operationsthat are used in rewriting queries submitted by user devices, anoriginal rewrite operation including a source term and a target term;identifying one or more queries, each query including the source term;for each query: identifying a first occurrence of the source term;identifying an importance weight of a last term in the source term;determining whether the query includes additional terms after the sourceterm in the query; identifying an importance weight of an additionalterm after the source term in the query based on the determination;determining whether the importance weight of the additional term afterthe source term in the query is greater than the importance weight ofthe last term in the source term; generating, by the contextualizedrewrite generator, a new rewrite source including the source term andthe additional term after the source term in the query, based on thedetermination; determining a number of times the new rewrite sourceappears in the one or more queries; and generating, by thecontextualized rewrite generator, a final rewrite operation includingthe new rewrite source if the number meets a threshold, wherein thefinal rewrite operation specifies replacing the source term in the newrewrite source with the target term receiving a search query submittedby a user device; generating, after receiving the search query and priorto providing content responsive to the search query, a rewritten querybased on rewriting the received query using the final rewrite operation,wherein the rewritten query differs from the search query submitted bythe user device; receiving, from a search system and in response tosubmitting the rewritten query to the search system, content selected bythe search system using the rewritten query; and providing, to the userdevice, and in response to the received search query, the receivedcontent.
 18. The computer readable storage medium of claim 17, theoperations further comprising: for each query: determining whether thequery includes additional terms prior to the source term in the query;identifying an importance weight of an additional term prior to thesource term in the query based on the determination; identifying animportance weight of a first term in the source term; determiningwhether the importance weight of the additional term prior to the sourceterm in the query is greater than the importance weight of the firstterm in the source term; and generating the new rewrite source includingthe source term and the additional term prior to the source term in thequery, based on the determination.
 19. The computer readable storagemedium of claim 17, the operations further comprising: for each query:determining whether the query includes further additional terms afterthe additional term after the source term in the query; identifying animportance weight of an additional term after the additional term afterthe source term in the query based on the determination; determiningwhether the importance weight of the additional term after theadditional term after the source term in the query is greater than theimportance weight of the additional term after the source term in thequery; and generating the new rewrite source including the additionalterm after the source term in the query and the additional term afterthe additional term prior to the source term in the query.
 20. Thecomputer readable storage medium of claim 17, wherein the search querysubmitted by the user device includes the new rewrite source, theoperations further comprising: generating keywords by applying the finalrewrite operation to the new rewrite source in the search querysubmitted by the user device; submitting the generated keywords to anadvertising system that is configured to identify advertisements thatare responsive to keywords; and providing, to the user device, one ormore advertisements received from the advertising system that theadvertising system identifies as responsive to the generated keywords.